package com.yupi.usercenter.base.model;

import com.yupi.usercenter.common.ErrorCode;
import lombok.Data;

@Data
public class ServiceException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    private Integer code;

    public ServiceException(ResultCodeEnum resultCode) {
        super(resultCode.getMsg());
        this.code = resultCode.getCode();
    }

    public ServiceException(RespCodeEnum resultCode) {
        super(resultCode.getMsg());
        this.code = resultCode.getCode();
    }

    public ServiceException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }
    public ServiceException(ErrorCode errorCode,String msg) {
        super(msg);
        this.code = errorCode.getCode();
    }


    public ServiceException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }


    public ServiceException(String msg) {
        super(msg);
    }

    public ServiceException(Throwable throwable) {
        super(throwable);
    }

    public ServiceException(String msg, Throwable throwable) {
        super(msg, throwable);
    }
}
